<?php
/**
 * Created by PhpStorm.
 * UsersF: Mloong
 * Date: 2018/12/24
 * Time: 17:22
 */

namespace app\http\middleware;


use app\api\validate\TongdunParam;
use app\lib\exception\ParameterException;

class checkTongdun
{
    public function handle($request,\Closure $next)
    {
        $validate = new TongdunParam();
        $result = $validate->batch()->check(input('post.'));
        if($result == false){
            throw new ParameterException([
                'msg' => $validate->getError()
            ]);
        }
        return $next($request);
    }
}